package com.ssmdemo.service.imp.empimpl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ssmdemo.dao.MenuMapper;
import com.ssmdemo.pojo.MenuEntity;
import com.ssmdemo.service.MenuService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class MenuServiceImp extends ServiceImpl<MenuMapper, MenuEntity> implements MenuService {

    public List<MenuEntity> getMenuListByParentId(Integer id) {

//        EntityWrapper<MenuEntity> wrapper=new EntityWrapper<MenuEntity>();
//        wrapper.eq("parent_menu_id",id);
//        List<MenuEntity> menuEntityList=selectList(wrapper);


        List<MenuEntity> menuEntityList=baseMapper.selectMenuListByParentId(id);

        return menuEntityList;
    }

    public int insertMenu(MenuEntity menuEntity) {
        baseMapper.insertMenu(menuEntity);
        return 1;
    }

    public int updateMenu(MenuEntity menuEntity) {
        baseMapper.updateMenu(menuEntity);
        return 1;
    }

    public List<Map<String, Object>> getAuthorizationMenuListByRoleId(Integer roleId) {
        List<Map<String, Object>> mapList=baseMapper.getAuthorizationMenuListByRoleId(roleId);
        return mapList;
    }
}
